package com.qzct.mapper;

import com.mybatisflex.core.BaseMapper;
import com.qzct.entity.AttractionImgs;
import com.qzct.entity.Attractions;
import com.qzct.entity.vo.AttractionVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.checkerframework.checker.units.qual.A;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *  映射层。
 *
 * @author 闽闽
 * @since 2025-01-11
 */
public interface AttractionsMapper extends BaseMapper<Attractions> {

    @Select("select max(attraction_id) from tb_attractions;")
    int getMaxId();

    @Select("select attraction_id from tb_attractions where attraction_id = 11")
    int getqqys();


    @Select("select attraction_id from tb_attractions where attraction_id = 4")
    int getlfs();


    @Select("SELECT attraction_id FROM tb_attractions WHERE attraction_id != 11 AND attraction_id!=4 ORDER BY like_count desc limit 0 , 4")
    ArrayList<Integer> gethot1();

    @Select("select attraction_id from tb_attractions where attraction_id = 12")
    int getxpc();

    @Select("select attraction_id from tb_attractions where attraction_id = 10")
    int getkys();

    @Select("SELECT attraction_id FROM tb_attractions WHERE attraction_id != 12 AND attraction_id!=10 ORDER BY like_count desc limit 0 , 4")
    ArrayList<Integer> gethot0();

    @Select("select attraction_id from tb_attractions ORDER BY like_count desc limit 0 , 6")
    ArrayList<Integer> getHot();

    @Update("UPDATE tb_attractions SET like_count = like_count+1 WHERE attraction_id = #{id}")
    void addlike(@Param("id") Serializable id);

    @Select("SELECT attraction_id as 'attractionId',name,description,address," +
            "ticket_price as 'ticketPrice',o" +
            "pen_time as 'openTime'," +
            "is_maintenance as 'isMaintenance'," +
            "like_count as 'likeCount'," +
            "comment_count as 'commentCount'," +
            "is_hot as 'isHot'," +
            "is_deleted as 'isDeleted'," +
            "phone_number as 'phoneNumber' from tb_attractions where is_deleted=0")
    ArrayList<Attractions> getList();
}


